package com.zh.chat.net;

import java.net.DatagramSocket;

public class DTOBase {
	protected String serverIp;// 配置文件
	protected int serverSendPort;// 配置文件
	protected int serverRecvPort;// 配置文件
	protected int TcpPort;// 收发图片的端口
	protected int TCP_TIMEOUT;// TCP连接超时
	protected DatagramSocket inSocket = null;// 监听端口
	protected DatagramSocket outSocket = null;// 发送端口
	protected int MAX_PACKET_SIZE = 2048;// UDP包大小
	protected int IMGBUFFER_SIZE = 40960;// 图片缓冲区大小
	protected String CHARSET;
	protected byte[] inBuf = null;
	protected byte[] outBuf = null;
	protected static String dateFormat = null;
	protected static String timeFormat = null;

	/**
	 * 设置配置文件
	 * 
	 * @param config
	 */
	public DTOBase(com.zh.chat.file.ConfigUtil config) {
		this.MAX_PACKET_SIZE = config.getInt("MAX_PACKET_SIZE");
		this.IMGBUFFER_SIZE = config.getInt("IMGBUFFER_SIZE");
		this.serverSendPort = config.getInt("SERVER_SEND_PORT");
		this.serverRecvPort = config.getInt("SERVER_RECV_PORT");
		this.serverIp = config.getString("SERVERIP");
		this.TcpPort = config.getInt("TCP_PORT");
		this.TCP_TIMEOUT = config.getInt("TCP_TIMEOUT");
		DTOBase.dateFormat = config.getString("DATE_FORMAT");
		DTOBase.timeFormat = config.getString("TIME_FORMAT");
		this.CHARSET = config.getString("CHARSET");
	}

	public String getServerIp() {
		return serverIp;
	}

	public void setServerIp(String serverIp) {
		this.serverIp = serverIp;
	}

	public int getServerSendPort() {
		return serverSendPort;
	}

	public void setServerSendPort(int serverSendPort) {
		this.serverSendPort = serverSendPort;
	}

	public int getServerRecvPort() {
		return serverRecvPort;
	}

	public void setServerRecvPort(int serverRecvPort) {
		this.serverRecvPort = serverRecvPort;
	}

	public int getTcpPort() {
		return TcpPort;
	}

	public void setTcpPort(int tcpPort) {
		TcpPort = tcpPort;
	}

	public int getTCP_TIMEOUT() {
		return TCP_TIMEOUT;
	}

	public void setTCP_TIMEOUT(int tCP_TIMEOUT) {
		TCP_TIMEOUT = tCP_TIMEOUT;
	}

	public DatagramSocket getInSocket() {
		return inSocket;
	}

	public void setInSocket(DatagramSocket inSocket) {
		this.inSocket = inSocket;
	}

	public DatagramSocket getOutSocket() {
		return outSocket;
	}

	public void setOutSocket(DatagramSocket outSocket) {
		this.outSocket = outSocket;
	}

	public int getMAX_PACKET_SIZE() {
		return MAX_PACKET_SIZE;
	}

	public void setMAX_PACKET_SIZE(int mAX_PACKET_SIZE) {
		MAX_PACKET_SIZE = mAX_PACKET_SIZE;
	}

	public int getIMGBUFFER_SIZE() {
		return IMGBUFFER_SIZE;
	}

	public void setIMGBUFFER_SIZE(int iMGBUFFER_SIZE) {
		IMGBUFFER_SIZE = iMGBUFFER_SIZE;
	}

	public String getCHARSET() {
		return CHARSET;
	}

	public void setCHARSET(String cHARSET) {
		CHARSET = cHARSET;
	}

	public byte[] getInBuf() {
		return inBuf;
	}

	public void setInBuf(byte[] inBuf) {
		this.inBuf = inBuf;
	}

	public byte[] getOutBuf() {
		return outBuf;
	}

	public void setOutBuf(byte[] outBuf) {
		this.outBuf = outBuf;
	}

}
